package cn.jeeweb.web.modules.sys.service.impl;

import cn.jeeweb.common.mybatis.mvc.service.impl.CommonServiceImpl;
import cn.jeeweb.web.modules.sys.entity.UiSearchScheme;
import cn.jeeweb.web.modules.sys.mapper.UiSearchSchemeMapper;
import cn.jeeweb.web.modules.sys.service.IUiSearchSchemeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
* @description: ui_searchscheme服务实现
*/
@Transactional
@Service("uiSearchSchemeService")
public class UiSearchSchemeServiceImpl extends CommonServiceImpl<UiSearchSchemeMapper,UiSearchScheme> implements IUiSearchSchemeService {


    @Override
    public List<UiSearchScheme> getList(UiSearchScheme uiSearchScheme) {
        return baseMapper.getList(uiSearchScheme);
    }

    @Override
    public boolean insert(UiSearchScheme uiSearchScheme) {
        if("1".equals(uiSearchScheme.getIsDefault()+"")){
            baseMapper.updateIsDefault("0");
        }
        return super.insert(uiSearchScheme);
    }

    public boolean insertOrUpdate(UiSearchScheme uiSearchScheme){
        if("1".equals(uiSearchScheme.getIsDefault()+"")){
            baseMapper.updateIsDefault("0");
        }
        return super.insertOrUpdate(uiSearchScheme);
    }
}